-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
DashboardDomainsCardSearchView.swift
71 lines (66 loc) · 2.55 KB
/
DashboardDomainsCardSearchView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import SwiftUI
struct DashboardDomainsCardSearchView: View {
@SwiftUI.Environment(\.colorScheme) var colorScheme: ColorScheme
var body: some View {
VStack(alignment: .center) {
HStack {
Image(systemName: Constants.iconName)
.foregroundColor(Colors.icon)
.font(.system(size: Metrics.iconSize))
Text(Constants.searchBarPlaceholder)
.foregroundColor(Colors.text)
.font(.system(size: Metrics.fontSize))
Spacer()
}
.padding(.horizontal, Metrics.padding)
.frame(height: Metrics.searchBarHeight)
.background(
RoundedRectangle(cornerRadius: Metrics.containerCornerRadius)
.foregroundColor(Colors.containerBackground)
)
Spacer()
RoundedRectangle(cornerRadius: Metrics.containerCornerRadius)
.foregroundColor(Colors.containerBackground)
}
.padding([.leading, .trailing, .top], Metrics.padding)
.frame(height: Metrics.height)
.background(
ZStack {
LinearGradient(
gradient: Gradient(
colors: [
colorScheme == .light ? Colors.gradientTopLight : Colors.gradientTopDark,
Color.clear
]
),
startPoint: .top,
endPoint: .bottom
)
}
)
.cornerRadius(Metrics.cornerRadius)
.accessibilityHidden(true)
}
}
private extension DashboardDomainsCardSearchView {
enum Metrics {
static let padding: CGFloat = 8
static let cornerRadius: CGFloat = 16
static let containerCornerRadius: CGFloat = 8
static let iconSize: CGFloat = 20
static let fontSize: CGFloat = 15 // fixed .footnote style size
static let height: CGFloat = 110
static let searchBarHeight: CGFloat = 40
}
enum Constants {
static let iconName = "globe"
static let searchBarPlaceholder = "yourgroovydomain.com"
}
enum Colors {
static let gradientTopLight = Color(UIColor.secondarySystemBackground)
static let gradientTopDark = Color(UIColor.tertiarySystemBackground)
static let containerBackground = Color(UIColor.secondarySystemGroupedBackground)
static let icon = Color(UIColor.jetpackGreen)
static let text = Color(UIColor.textSubtle)
}
}